
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 柚木
  Date: 2022/12/28
  Time: 15:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="css/includePage.css">
    <link rel="stylesheet" href="css/messagePage.css">
    <script src="https://kit.fontawesome.com/e91f25b25e.js" crossorigin="anonymous"></script>
    <title>图书管理系统-留言板</title>
</head>
<%@ include file="IncludePage.jsp"  %>

<div class="container">
    <div class="comment-box">
        <div class="comment-form">
            <div class="header">留言板</div>
            <form action="addMessage" method="post">
                <div>
                    <input class="message" type="text" name="message" id="message" placeholder="请输入留言内容">
                </div>
                <input type="submit" value="留言" class="button">
            </form>
        </div>
        <div>
            <h4 class="header">留言列表</h4>
            <c:if test="${sessionScope.deleteMsg != null}">
                <div class="delete-error">
                    <i class="fa-solid fa-circle-exclamation error-icon"></i>
                    <p class="error-msg">${sessionScope.deleteMsg}</p>
                </div>
            </c:if>
            <c:forEach items="${sessionScope.messageList}" var="message">
                <div class="comments">
                    <hr>
                    <h4>
                        <span class="name">${message.username}</span>
                        <a href="deleteMessage?username=${message.username}&time=${message.time}" class="delete"> 删除</a>
                        <span class="date">${message.time}</span>
                    </h4>
                    <div class="comment-text">${message.comment}</div>
                </div>
            </c:forEach>
        </div>
    </div>
</div>

</div>
<script src="js/includePage.js"></script>
<script src="js/message.js"></script>
</body>
</html>
